﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.Data;
using System.Data.SqlClient;
public partial class User_Admin_AddRole : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBoxRole.Text != "")
            Roles.CreateRole(TextBoxRole.Text);
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //DataAccess.TblBakhsh.Update("948d5162-7e88-47d9-9f99-e57ca3e713b2", , "d75bd696-aff2-4eed-95d4-ad70d2b1634b");
    
        SubSonic.Query q = DataAccess.TblBakhsh.CreateQuery();
        q.QueryType = SubSonic.QueryType.Update;
        q.AddUpdateSetting(DataAccess.TblBakhsh.Columns.Name,"پاسارگاد");
        q.AddWhere(DataAccess.TblBakhsh.Columns.Id,"948d5162-7e88-47d9-9f99-e57ca3e713b2");
        q.Execute();
    }
    protected void Button3_Click(object sender, EventArgs e)
    {
        SubSonic.Query q = DataAccess.TblContract.CreateQuery();
        q.QueryType = SubSonic.QueryType.Update;
        q.AddUpdateSetting(DataAccess.TblContract.Columns.Year, "1390");
        q.AddWhere(DataAccess.TblContract.Columns.Year, "9");
        q.OR(DataAccess.TblContract.Columns.Year, "11");
        q.Execute();
    }
    protected void Button4_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection con = new SqlConnection(DataAccess.Global.GetConnectionString().ToString());
            con.Open();
            SqlCommand com = new SqlCommand("ALTER TABLE TblContract ADD FourthFactorUserId uniqueidentifier", con);
             com.ExecuteScalar();
            con.Close();
           
            Lblstatus.Text = " <script>alert('.  ثبت ستون انجام شد ')</script>";
        }
        catch
        {
            Lblstatus.Text = " <script>alert('.  ثبت ستون با خطا مواجه شد ')</script>";
        }
    }
    protected void Button5_Click(object sender, EventArgs e)
    {
        try
        {
            SqlConnection con = new SqlConnection(DataAccess.Global.GetConnectionString().ToString());
            con.Open();
            SqlCommand com = new SqlCommand("ALTER TABLE TblUserDetail ADD CityId uniqueidentifier", con);
            com.ExecuteScalar();
            con.Close();

            Lblstatus.Text = " <script>alert('.  ثبت ستون انجام شد ')</script>";
        }
        catch
        {
            Lblstatus.Text = " <script>alert('.  ثبت ستون با خطا مواجه شد ')</script>";
        }
    }
    protected void Button6_Click(object sender, EventArgs e)
    {
        SqlConnection con = new SqlConnection(DataAccess.Global.GetConnectionString().ToString());
        con.Open();
        SqlCommand com = new SqlCommand("Create TABLE TblNotification(Id uniqueidentifier PRIMARY KEY,UserId uniqueidentifier,Message Nvarchar(Max),IsRead bit,Date DateTime);", con);
        com.ExecuteScalar();
        con.Close();

        Lblstatus.Text = " <script>alert('.  ثبت ستون انجام شد ')</script>";
    }
}